/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.given.designpatterns.creational.abstractfactorypattern.factory;

import za.ac.cput.given.designpatterns.creational.abstractfactorypattern.factory.Impl.MammalFactory;
import za.ac.cput.given.designpatterns.creational.abstractfactorypattern.factory.Impl.SpeciesFactory;
import za.ac.cput.given.designpatterns.creational.abstractfactorypattern.factory.Impl.ReptileFactory;

/**
 *
 * @author staff
 */
public class AbstractFactory {

    private static AbstractFactory abstractFactory = null;

    private AbstractFactory() {
    }
    
    public static AbstractFactory getAbstractFactoryInstance(){
        if(abstractFactory == null){
            abstractFactory = new AbstractFactory();
        }
        return abstractFactory;
    }

    public SpeciesFactory getSpeciesFactory(String type) {
        if ("mammal".equals(type)) {
            return new MammalFactory();
        } else {
            return new ReptileFactory();
        }
    }
}
